package com.ynny.chapter05;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

//request作用域 的范围 只在 一次请求中有效
@WebServlet("/demo05")
public class Demo05Servlet extends HttpServlet {

    //往请求作用域中放一个用户 userName = "张三";

    @Override
    protected void service(HttpServletRequest request,
                           HttpServletResponse response) throws ServletException, IOException {

        //存放东西的位置
        request.setAttribute("userName", "张三");
        request.setAttribute("sum",20);

    }
}
